package com.sample.mapping;

import javax.persistence.Column;


public class Post<T> extends AbstractMapping<T> {

	@Column(name="user_id")
	private T userId;
	
	@Column(name="content_id")//id of audio, video, text, url, picture
	private T contentId;
		
	public T getUserId() {
		return userId;
	}	
		
	public T getContentId() {
		return contentId;
	}

	public void setContentId(T contentId) {
		this.contentId = contentId;
	}
		
	public void setUserId(T userId) {
		this.userId = userId;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((contentId == null) ? 0 : contentId.hashCode());
		result = prime * result + ((userId == null) ? 0 : userId.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Post other = (Post) obj;
		if (contentId == null) {
			if (other.contentId != null)
				return false;
		} else if (!contentId.equals(other.contentId))
			return false;
		if (userId == null) {
			if (other.userId != null)
				return false;
		} else if (!userId.equals(other.userId))
			return false;
		return true;
	}
}
